package com.outsider.tool.rsa;

import java.util.Scanner;

public class Test {
   public  static void main(String args[]){
   System.out.print("请输入待加密的字符串：");
   Scanner in=new Scanner(System.in);
   String input=in.nextLine();
   RSATool rsaTool=new RSATool(input);
   System.out.printf("公钥为(%d,%d),私钥为（%d，%d)\n",rsaTool.getP()*rsaTool.getQ(),rsaTool.getE(),rsaTool.getP()*rsaTool.getQ(),rsaTool.getD());
   System.out.print("原字符串对应AscII码：");
   for (int i=0;i<rsaTool.getAskIIMessage().length;i++)
	   System.out.print((int)rsaTool.getAskIIMessage()[i]+",");
   System.out.println();
   System.out.println("==============加密====================");
   rsaTool.encrpt();
   rsaTool.decrpt();
   System.out.print("加密后字符串（数字形式）：");
   for (int i=0;i<rsaTool.getEm().length;i++)
	   System.out.print(rsaTool.getEm()[i]+",");
   System.out.println();
   System.out.println("==============解密====================");
   System.out.print("解密后后字符串：");
   
   for (int i=0;i<rsaTool.getMessage().length;i++)
	   System.out.print(rsaTool.getMessage()[i]);
}
}